package logic

import (
	"context"
	"fmt"
	"video-hub/models/mysql"
	"video-hub/videorpc/internal/svc"
	"video-hub/videorpc/videorpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type SumVideoLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewSumVideoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SumVideoLogic {
	return &SumVideoLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *SumVideoLogic) SumVideo(in *videorpc.SumVideoRequest) (*videorpc.SumVideoResponse, error) {
	// todo: add your logic here and delete this line
	var video mysql.Video
	sum := 0
	sum = int(in.VideoId * in.PlayNum)
	fmt.Println(sum)
	return &videorpc.SumVideoResponse{
		VideoId: int64(int(video.ID)),
	}, nil
}
